import { request } from '../request';

/**
 * 获取源数据分页列表
 *
 * @param params
 */
export function getSourceDataPage(params: any) {
  return request<Api.Common.PagingResult<Api.SourceData.SourceData>>({
    url: '/api/source-data',
    method: 'get',
    params
  });
}

/**
 * 获取源数据详情
 *
 * @param id
 */
export function getSourceDataById(id: number) {
  return request<Api.SourceData.SourceData>({
    url: `/api/source-data/${id}`,
    method: 'get'
  });
}

/**
 * 创建源数据
 *
 * @param data
 */
export function createSourceData(data: any) {
  return request({
    url: '/api/source-data',
    method: 'post',
    data
  });
}

/**
 * 更新源数据
 *
 * @param id
 * @param data
 */
export function updateSourceData(id: number, data: any) {
  return request({
    url: `/api/source-data/${id}`,
    method: 'put',
    data
  });
}

/**
 * 删除源数据
 *
 * @param id
 */
export function deleteSourceData(id: number) {
  return request({
    url: `/api/source-data/${id}`,
    method: 'delete'
  });
}
